<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2021/5/27 0027
  Time: 16:53
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!--
THIS EXAMPLE WAS DOWNLOADED FROM https://echarts.apache.org/examples/zh/editor.html?c=bar-simple
-->
<!DOCTYPE html>
<html style="height: 100%">
<head>
    <meta charset="utf-8">
</head>
<body style="height: 100%; margin: 0">
<div id="container" style="height: 100%"></div>

<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/echarts-nightly@5.1.2-dev.20210512/dist/echarts.min.js"></script>
<script type="text/javascript" src="/admin/js/jquery-1.8.3.min.js"></script>
<script type="text/javascript">
    var dom = document.getElementById("container");
    var myChart = echarts.init(dom);
    var app = {};

    var option;

    //获取数据
    $.getJSON("/admin/gettopic",function (data) {
        //解析数据
        var mycars = new Array()
        var mycarsd = new Array()
        for (var i = 0; i < data.length; i++) {
            var topic = data[i];
            mycars.push(topic.typename);
            mycarsd.push(topic.id);
        }
        option = {
            xAxis: {
                type: 'category',
                data:mycars
            },
            yAxis: {
                type: 'value'
            },
            series: [{
                data: mycarsd,
                type: 'bar'
            }]

        };


        myChart.setOption(option);
    });




</script>
</body>
</html>
